{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "540b21f2-6865-466b-828a-4f2bbc749ade",
   "metadata": {},
   "source": [
    "# SPADEGAN "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fdfc30a5-7884-482c-a523-4c2da0a24740",
   "metadata": {
    "jp-MarkdownHeadingCollapsed": true
   },
   "source": [
    "## Install Model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2a96240c-b8f1-4ef9-a5df-716e9c4fb346",
   "metadata": {},
   "outputs": [],
   "source": [
    "!git clone https://github.com/NVlabs/SPADE.git"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "801d4a7c-23d0-4a25-8309-0d60a9cdaf5a",
   "metadata": {},
   "outputs": [],
   "source": [
    "%cd SPADE"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aa093a74-92b0-4947-ada3-9c6c3fd42fe5",
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install -r requirements.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "71192e31-9fa6-47f6-8ccf-b13baa373215",
   "metadata": {},
   "outputs": [],
   "source": [
    "%cd models/networks/\n",
    "!git clone https://github.com/vacancy/Synchronized-BatchNorm-PyTorch\n",
    "!cp -rf Synchronized-BatchNorm-PyTorch/sync_batchnorm .\n",
    "%cd ../../"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1b86179f-99aa-4f3b-ab91-af75a6dde122",
   "metadata": {
    "jp-MarkdownHeadingCollapsed": true
   },
   "source": [
    "## Train + Test"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f1e6887b-4436-4c74-9a18-cac640eb351d",
   "metadata": {},
   "source": [
    "Training Line:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6b014282-c94d-47f8-9273-d41a98aae53d",
   "metadata": {},
   "outputs": [],
   "source": [
    "!python train.py --name project_name --dataset_mode custom --label_dir path/to/labels --image_dir path/to/images --label_nc [number_of_label_classes]  --max_dataset_size MAX_DATASET_SIZE --no_instance\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b1e4a27d-b475-4485-8db4-c8453ad8a367",
   "metadata": {},
   "source": [
    "Testing Line:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "acccd028-8487-4ada-b30b-9faef10533e3",
   "metadata": {},
   "outputs": [],
   "source": [
    "!python test.py --name project_name --dataset_mode custom --label_dir path/to/labels --image_dir path/to/images --label_nc [number_of_label_classes] --how_many [x_images_to_generate] --no_instance"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
